#! /bin/sh


OPTIND=1         # Reset in case getopts has been used previously in the shell.

CONFIGURATION=wraith.conf.make
USE_LIBPCAP=no
INJECTABLE=no

while getopts :-: arg; do
  case $arg in
    - )  LONG_OPTARG="${OPTARG#*=}"
         case $OPTARG in
           use-libpcap    )  USE_LIBPCAP=yes ;;
           injectable ) INJECTABLE=yes ;;
           use-libpcap* )
                       echo "No arg allowed for --$OPTARG option" >&2; exit 2 ;;
           '' )        break ;; # "--" terminates argument processing
           * )         echo "Illegal option --$OPTARG" >&2; exit 2 ;;
         esac ;;
    \? ) exit 2 ;;  # getopts already reported the illegal option
  esac
done
shift $((OPTIND-1)) # remove parsed options and args from $@ list

echo "Enable libpcap = $USE_LIBPCAP"
echo "Injectable     = $INJECTABLE"

echo "# This file was automatically generated by configure.sh" > $CONFIGURATION
echo "USE_LIBPCAP=$USE_LIBPCAP" >> $CONFIGURATION
echo "INJECTABLE=$INJECTABLE" >> $CONFIGURATION
